package small.common.designPattern.structure.proxy;


/**
 * @Author zhoujin
 * @Date 2022/6/26 16:19
 */
public class AdvisedSupport<T> {

    private TargetSource<T> targetSource;

    private AopMethodInterceptor aopMethodInterceptor;

    private MethodMatcher methodMatcher;

    public AdvisedSupport(TargetSource targetSource, AopMethodInterceptor aopMethodInterceptor) {
        if (targetSource == null || aopMethodInterceptor == null) {
            throw new IllegalArgumentException("Both 'targetSource' and 'methodInterceptor' must not be null");
        }
        this.targetSource = targetSource;
        this.aopMethodInterceptor = aopMethodInterceptor;
    }

    public AdvisedSupport(TargetSource targetSource, AopMethodInterceptor methodInterceptor, MethodMatcher methodMatcher) {
        if (targetSource == null || methodInterceptor == null) {
            throw new IllegalArgumentException("Both 'targetSource' and 'methodInterceptor' must not be null");
        }
        this.targetSource = targetSource;
        this.aopMethodInterceptor = methodInterceptor;
        this.methodMatcher = methodMatcher;
    }

    public TargetSource getTargetSource() {
        return targetSource;
    }

    public AopMethodInterceptor getAopMethodInterceptor() {
        return aopMethodInterceptor;
    }


    public MethodMatcher getMethodMatcher() {
        return methodMatcher;
    }

    public void setMethodMatcher(MethodMatcher methodMatcher) {
        this.methodMatcher = methodMatcher;
    }
}
